package org.jw.wishlist.exception;

import static org.apache.commons.lang3.ObjectUtils.isEmpty;

/**
 * @author Jiawei Zhao
 */
public class LinkCodeParseFailedException extends ResolverException {

  public LinkCodeParseFailedException(String reason) {
    super(getMessage(reason));
  }

  public LinkCodeParseFailedException(String reason, Throwable cause) {
    super(getMessage(reason), cause);
  }

  private static String getMessage(String reason) {
    return String.format("解析失败, 原因: %s", isEmpty(reason) ? "未知错误" : reason);
  }

}
